package com.jquery.db;

import java.io.Reader;

import org.apache.log4j.Logger;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class IBatisSettingLoader {
	
	private static Logger log = Logger.getLogger("SqlMapClientManager");
	private static final SqlMapClient sqlMap;

    static {
            try {
                    String resource = "com/jquery/config/SqlMapConfig.xml";
                    Reader reader = Resources.getResourceAsReader(resource);
                    sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
            } catch (Exception e) {
                    e.printStackTrace();
            		log.error("SqlMapClientManager Exception :"+e.getMessage());
                    throw new RuntimeException(e);
            }
    }
    
    public static SqlMapClient getSqlMapClient() {
        return sqlMap;   
    }

}
